## Incorporating Sound Objects into Games

This is a simple explanation of how to link a Sound Object to the main program and play a song during an actual game. Refer to the AGB Music Player PROGRAMMER'S MANUAL for programming details.

The object files used in actual games are all output to the out_dir which is specified in the output directory mks4agb.ini. A file containing a list of the file names (Soundfiles) is output at the same time. For this reason, to link sound objects to the main program, the "Makefile" is modified as below and all of the files in out_dir are copied into the necessary directory and execute Make.

    *Add the following two lines to the start of the "Makefile."*
    SOUND_DIR = The directory name where the sound files are placed./
    include $(SOUND_DIR)Soundfiles

             *Add the $(SOUND_FILES) to the links.*

    $(TARGET_ELF): $(.OFILES) $(SOUND_FILES) Makefile $(DEPENDFILE)
        @echo > $(MAPFILE)
        $(CC) -g -o $@ $(.OFILES) $(SOUND_FILES) -Wl,$(LDFLAGS)

It is possible that .o files from the Waveform Data or the Song Data that were lost when the sound data was being created in out_dir are left over. However, no unnecessary object file names will be output to Soundfiles so there is no danger of linking to leftover files.

Next:[ Calling Sound Functions ] TOP :[ Table of Contents ]